package com.koron.system.login.controller;

import com.koron.bean.base.Response;
import com.koron.bean.query.PageQuery;
import com.koron.system.login.bean.po.LoginInfoPo;
import com.koron.system.login.service.LoginInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * (LoginInfo)表控制层
 *
 * @author zhouj
 * @since 2021-12-06 10:13:36
 */
@Api(tags = "(登录信息)")
@RestController
@RequestMapping("/loginInfo/")
public class LoginInfoController {

    @Autowired
    private LoginInfoService loginInfoService;

    @ApiOperation(value = "新增或修改")
    @PostMapping("insertOrUpdate")
    public Response insertOrUpdate(LoginInfoPo loginInfo) {
        return Response.ok(loginInfoService.insertOrUpdate(loginInfo));
    }

    @ApiOperation(value = "新增")
    @PostMapping("insert")
    public Response insert(LoginInfoPo loginInfo) {
        return Response.ok(loginInfoService.insert(loginInfo));
    }

    @ApiOperation(value = "批量新增")
    @PostMapping("insertBatch")
    public Response insertBatch(List<LoginInfoPo> loginInfoList) {
        return Response.ok(loginInfoService.insertBatch(loginInfoList));
    }

    @ApiOperation(value = "根据id更新")
    @PutMapping("update")
    public Response update(LoginInfoPo loginInfo) {
        return Response.ok(loginInfoService.update(loginInfo));
    }

    @ApiOperation(value = "根据id删除")
    @DeleteMapping("deleteById")
    public Response deleteById(String id) {
        return Response.ok(loginInfoService.deleteById(id));
    }

    @ApiOperation(value = "根据id查询")
    @GetMapping("queryById")
    public Response queryById(String id) {
        return Response.ok(loginInfoService.queryById(id));
    }

    @ApiOperation(value = "不分页查询列表")
    @GetMapping("queryList")
    public Response queryList(LoginInfoPo queryVo) {
        return Response.ok(loginInfoService.queryList(queryVo));
    }

    @ApiOperation(value = "分页查询列表")
    @GetMapping("queryPageList")
    public Response queryPageList(LoginInfoPo queryPo, PageQuery pageQuery) {
        return Response.ok(loginInfoService.queryPageList(queryPo, pageQuery));
    }

}
